using System;
using Portal.API;
using System.Web;
namespace Portal
{
    [AjaxPro.AjaxNamespace("LogActionAjax")]
    public partial class ManagementContent : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            // Kiem tra xem neu nguoi nay cua login thi quay ve trang Login.chn
            if (Context.User.Identity.Name == "" && Context.Request.Url.AbsolutePath.ToLower().IndexOf("home.chn") >=0) 
                Response.Redirect("/login.chn");

            
            DateTime dt = DateTime.Now;
            TimeSpan ts = new TimeSpan(0, 30, 0);
             ///
            HttpCookie cookie1 = new HttpCookie("FileManager");
            cookie1.Values["PW"] = Crypto.EncryptByDay(Context.User.Identity.Name);
            cookie1.Expires = dt.Add(ts);
            Response.Cookies.Add(cookie1);

            //AjaxPro.Utility.RegisterTypeForAjax(typeof(Portal.BO.Editoral.Newslist.NewslistHelper), Page);
            //AjaxPro.Utility.RegisterTypeForAjax(typeof(ManagementContent), Page);

			if (!ClientScript.IsClientScriptBlockRegistered("MPosition") && Page.User.IsInRole(Config.AdminRoles))
            {
                ClientScript.RegisterClientScriptBlock(GetType(),"MPosition", "<script src=\"scripts/MPosition.js\"></script>");
            }
            PortalDefinition.Tab _objCurrentTab = PortalDefinition.GetCurrentTab();

            if (_objCurrentTab != null)
                if (_objCurrentTab.reference.IndexOf("office") < 0)
                    Session.Remove("cpmode");


			
        }
    }
}
